package org.goldfish.spring_tutorial.controller;

import org.goldfish.spring_tutorial.db.WebVisitorActionRepository;
import org.goldfish.spring_tutorial.entity.WebVisitorAction;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Controller
@RequestMapping("/show")
public class WebVisitorActionDisplayController {

    @Autowired
    private WebVisitorActionRepository webVisitorActionRepository;


    @GetMapping
    public String hello(Model model) {
        Iterable<WebVisitorAction> actions = webVisitorActionRepository.findAll();
        model.addAttribute("actions", actions);
        return "visitor_actions";
    }


}
